package com.domino.client;


import java.util.Date;
import java.util.Random;

import com.domino.client.mvc.Controller;
import com.domino.client.mvc.impl.ControllerImpl;
import com.domino.client.view.BoardGamePanel;
import com.domino.client.view.BoardGamePanelDebug;
import com.domino.shared.model.SimpleBoard;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class Othello implements EntryPoint {

	/**
	 * This is the entry point method.
	 */
	public void onModuleLoad() {
		Controller control = new ControllerImpl((OthelloServiceAsync) GWT.create(OthelloService.class));
		int size = getSize();
		BoardGamePanel bw = getBoardGamePanel(control, size);
	}

	private int getSize() {
		return SimpleBoard.NORMAL_SIZE; 
			/*new Random(new Date().getTime()).nextBoolean() ?
				SimpleBoard.SMALL_SIZE : SimpleBoard.NORMAL_SIZE;*/
	}

	private BoardGamePanel getBoardGamePanel(Controller control, int size) {
		if (BoardGamePanelDebug.isDebugPage()) {
			return new BoardGamePanelDebug(control, size);
		}
		return new BoardGamePanel(control, size);
	}
	
}
